// 引入redux
import {createStore, combineReducers, applyMiddleware} from 'redux'
// 导入日志的中间件
import {createLogger} from 'redux-logger'
// 使用devtools工具，需要安装浏览器插件，并在项目中安装依赖
import { composeWithDevTools } from 'redux-devtools-extension';
import userReducer from './user'
import orderReducer from './order'

// combineReducers合并各个模块的reducer
const rootReducer = combineReducers({
  user: userReducer,
  order: orderReducer
})
const logger = createLogger()
// 创建仓库
// composeWithDevTools 在创建组件是使用devtools 
const store = createStore(rootReducer, composeWithDevTools(applyMiddleware(logger)));
export default store;